/*
 * CloseIcon.fx
 *
 * Created on Apr 12, 2010, 2:11:10 PM
 */

package fxgreader.components;
import javafx.scene.CustomNode;
import javafx.scene.Node;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.scene.Group;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.Cursor;
import javafx.scene.input.MouseEvent;

/**
 * @author perkintang
 */

public class CloseIcon extends CustomNode{
public var onClick : function();
override var cursor = Cursor.HAND;
var path = Path {
        fill : Color.WHITE
elements: [
    MoveTo { x: 0    y: 0 },
    LineTo { x: 0  y: 20},
    LineTo { x: 20  y: 20},
    LineTo { x: 20  y: 0},
    LineTo { x: 0  y: 0},
    LineTo { x: 20  y: 20},
    LineTo { x: 20  y: 0},
    LineTo { x: 0  y: 20},
    LineTo { x: 0  y: 0},
    ]
}
var back = Rectangle {
    x: 0  y: 0
    width: 20  height: 20
    fill : Color.WHITE
};
override protected function create () : Node {
    return Group{
                onMouseClicked : function(even :MouseEvent):Void{
                        onClick();
                        }
                content : [back,path]
                };
}
}
